SPL provides multiple iterator classes that provide iterative access, filtering data, caching results, and controlling paging. , because PHP is always growing, I try to list all of the iteration classes in SPL. Some of the following iterator classes
One: What is an iteratorThe process of iterating through a linked list or an element in an array in a uniform way is called iterative traversal, which we call an iterator.II: Arrayiterator iterators1:iterator interfaceIterators in PHP are defined by
Php essence php design model
1. select the most appropriate design modeNothing is perfect, and no one has ever said that the design model is a perfect solution. Therefore, you can change these patterns to make them more suitable for your
PHP SPL can be seen in many frameworks and MVC, and PHP SPL accounts for a large proportion of the actual applications. Doubly linked list push (1), $obj->push (2), $obj->push (3); $obj->unshift (10); Unshifit takes the last element of the
PHP predefined interface. PHP pre-defined interface introduction there are several pre-defined interfaces in PHP. it is also useful for IteratorAggregate (Iterator of aggregate Iterator) IteratorAggregateextendsTraversable PHP pre-defined
Php spl can be seen in many frameworks and MVC. php spl accounts for a large proportion in many practical applications.
Two-Way linked list
Push (1); $ obj-> push (2); $ obj-> push (3); $ obj-> unshift (10 ); // unshifit occupies the last
PHPSPL can be seen in many frameworks and MVC. PHPSPL accounts for a large proportion in many practical applications. php spl can be seen in many frameworks and MVC, php spl accounts for a large proportion in many practical applications.
Two-Way
PHP SPL can be seen in many frameworks and MVC, and PHP SPL accounts for a large proportion of the actual applications.
Doubly linked list
push (1), $obj->push (2), $obj->push (3); $obj->unshift (Ten) ; Unshifit Replace the header $obj->rewind ()
There are several predefined interfaces in PHP, more commonly used four interfaces (iteratoraggregate (aggregated aggregate iterator iterator),countable, Arrayaccess,iterator) to give you a detailed introduction.
Iteratoraggregate (aggregated
Introduction in PHP has several predefined interfaces, but also useful iteratoraggregate (aggregated aggregate iterator iterator) Iteratoraggregate extends traversable {Abstract public traversable getiterator (void)} This interface implements a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.